package io.github.ali.commons.code;

import io.github.ali.commons.exception.BizException;
import io.github.ali.commons.exception.BizRuntimeException;

import java.util.function.Function;
import java.util.function.Supplier;

/**
 * 内部系统异常码和信息
 * @author ALi
 * @version 1.0
 * @date 2024-06-05 19:26
 * @description
 */
public interface ExceptionCode extends Supplier<RuntimeException>, Function<Object,RuntimeException> {
    /**
     * 获取内部错误码
     * @return
     */
    String getErrorCode() ;

    /**
     * 获取内部错误信息
     * @return
     */
    String getErrorMsg() ;

    /**
     * 获取外部响应码
     * @return
     */
    RespCode getRespCode() ;

    /** 构建BizRuntimeException */
    BizRuntimeException buildBizRuntimeException();
    BizRuntimeException buildBizRuntimeException(String message);
    BizRuntimeException buildBizRuntimeException(Throwable cause);
    BizRuntimeException buildBizRuntimeException(Throwable cause, String message);
    /** 构建BizException */
    BizException buildBizException();
    BizException buildBizException(String message);
    BizException buildBizException(Throwable cause);
    BizException buildBizException(Throwable cause, String message);
}
